package isssr.bean.boundary;

import java.io.Serializable;

import javax.annotation.PostConstruct;

import isssr.bean.entity.CurrentUser;
import isssr.bean.entity.User;

public class EnactorTable implements Serializable {

	
	
	private LazyEnactorDataModel 	dataModel;
	private CurrentUser				current_user;
	private User 					selectedUser;
	private boolean 				render_selected_enactor;
	private ActivityGOBoundary 		main_boundary;
	
	
	public EnactorTable (){}
	
	
	@PostConstruct
	public void init()
	{
		if(this.current_user != null)
		{
			User user 		= this.current_user.getUser();
			this.dataModel 	= new LazyEnactorDataModel(user);
		}
	}
	
	
	public LazyEnactorDataModel getDataModel() {
		return dataModel;
	}


	public void setDataModel(LazyEnactorDataModel dataModel) {
		this.dataModel = dataModel;
	}

	
	public void setCurrent_user(CurrentUser current_user) {
		this.current_user = current_user;
	}


	public User getSelectedUser() {		
		return selectedUser;
	}

	
	public void selectUser(User selectedUser) {
		this.selectedUser = selectedUser;
		this.setRender_selected_enactor(true);
	}
	
	
	public boolean isRender_selected_enactor() {
		return render_selected_enactor;
	}


	public void setRender_selected_enactor(boolean render_selected_enactor) {
		this.render_selected_enactor = render_selected_enactor;
	}

	
	public void setMain_boundary(ActivityGOBoundary main_boundary) {
		this.main_boundary = main_boundary;
	}


	public void removeSelectedUser()
	{
		this.selectedUser = null;
		this.setRender_selected_enactor(false);
	}
	
	
	public void confirmSelection()
	{
		this.main_boundary.setGoalEnactor(this.selectedUser);
	}
	
	
	public void cancelSelection()
	{
		this.selectedUser = this.main_boundary.getGoalEnactor();
	}
	
}
